
package org.csu.onlineedubackend.controller;

import org.csu.onlineedubackend.entity.Course;
import org.csu.onlineedubackend.service.CourseFilterService;
import org.csu.onlineedubackend.result.CommonResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/courses")
public class CourseFilterController {

    @Autowired
    private CourseFilterService courseFilterService;

    @GetMapping("/filter")
    public CommonResponse<List<Course>> getFilteredCourses(
            @RequestParam(required = false) String category,
            @RequestParam(required = false) String level,
            @RequestParam(required = false) String sort,
            @RequestParam(required = false) String search) {
        return courseFilterService.getFilteredCourses(category, level, sort, search);
    }
} 